-- UNITDEF -- pawnclose_iv --
--------------------------------------------------------------------------------

local unitName = "pawnclose_iv"

--------------------------------------------------------------------------------

local unitDef = {
  acceleration       = 0.75,
  brakeRate          = 0.75,
  buildCostMetal     = 10,
  canAttack          = true,
  canMove            = true,
  canstop            = 1,
  category           = [[PAWN UNARMORED UNIT TARGET]],
  collisionvolumetest = 1,
corpse              = [[DEAD]],
  description        = [[Assault Lv 4]],
  energyMake         = 0,
  energyStorage      = 0,
  explodeAs          = [[Death]],
  footprintX         = 2,
  footprintZ         = 2,
  iconType           = [[PAWN]],
  idleAutoHeal       = 10,
  idleTime           = 300,
  levelGround        = false,
  maxDamage          = 675, 
  maxVelocity        = 1.5,
  metalMake          = 0,
  metalStorage       = 0,
  movementClass      = [[medium]],
  name               = [[Advanced Tengu Armor]],
  noChaseCategory    = [[NOTARGET AIR]],
  objectName         = [[pawnclose_iv.s3o]],
  radarDistance      = 0,
  reclaimable        = false,
  seismicSignature   = 1,
  selfDestructAs     = [[Death]],
  selfDestructCountdown = 1,
  showNanoFrame      = false,
  sightDistance      = 800,
  smoothAnim         = false,
  turnRate           = 500,
  unitname           = [[pawnclose_iv]],
    upright            = true,
  sfxtypes = {
    explosiongenerators = {
[[custom:flashmuzzle1]],
[[custom:missileshot]],
[[custom:burning]],
    },
  },
  -- sounds = {
    -- arrived = {
      -- [[commandgiven]],
    -- },
    -- ok = {
      -- [[commandgiven]],
    -- },
    -- select = {
      -- [[select]],
    -- },
  -- },
  weapons = {
    [2]  = {
      def                = [[civwep2]],	-- see comment at pawnclose
      onlyTargetCategory = [[TARGET]],
	  badtargetcategory  = [[NOTARGET]],	
	  mainDir = "0 0 1",
      maxAngleDif = 170,
    },
    [1]  = {
      def                = [[civwep1]],
      onlyTargetCategory = [[TARGET]],
	  badtargetcategory  = [[NOTARGET]],
	  mainDir = "0 0 1",
      maxAngleDif = 170,
    },
  },
}


--------------------------------------------------------------------------------

local weaponDefs = {
 civwep1 = {
	id                 = 4,
	avoidFriendly      = false,
    burst              = 3,
    burstrate          = .3,
    collideFriendly    = false,
    craterBoost        = 0,
    craterMult         = 0,
    duration           = .03,
    explosionGenerator = [[custom:none]],
    id                 = 1,
    impactonly         = 1,
    impulseBoost       = 0,
    impulseFactor      = 0,
    name               = [[Auto Cannon]],
    range              = 300,	-- 300
    reloadtime         = 3,
    rgbColor           = [[1 .5 .2]],
    soundStart         = [[autocannon]],
    sprayAngle         = 200,
    thickness          = 1,
    tolerance          = 1000,
    turret             = true,
    weaponType         = [[LaserCannon]],
    weaponVelocity     = 1000,
	InterceptedByShieldType = 2,
    damage = {
      default            = 30,
			 },
  },
  
  civwep2 = {
	name = [[Rocket Launcher]],
	id = 4,
	rendertype = 4,
	ballistic = 1,
	turret = 1,
	collideFriendly    = false, --for now
	energypershot = 0,
	range = 240,
	burst = 5,
	burstrate = 0.3,
	reloadtime = 3, 
	weaponvelocity = 900,
	areaofeffect = 20,
	edgeeffectiveness = 1,
	model = [[srocket.s3o]],
	soundstart = [[rockfire2]],
	soundhit = [[rockhit2]],
	firestarter = 50,
	accuracy = 300,
	aimrate = 1000,
	tolerance = 300,
	holdtime = 1,
	explosiongenerator = [[custom:SMALLMISSILE_EXPLOSION]],
	startsmoke = 1,
	impulsefactor = 0,
	impulseBoost = 0,
	craterMult = 0,
	craterBoost = 0,
	InterceptedByShieldType = 2,
    damage = {
      default            = 27,
    },
  },
  }
unitDef.weaponDefs = weaponDefs

local featureDefs = {
    DEAD  = {
      description      = [[Wreckage - pawn]],
      blocking         = true,
      category         = [[corpses]],
      damage           = 1000,
      energy           = 0,
	  featureDead      = [[HEAP]],
      featurereclamate = [[SMUDGE01]],
      footprintX       = 2,
      footprintZ       = 3,
      height           = [[20]],
      hitdensity       = [[100]],
      metal            = 0,
      object           = [[pawnclose_iii_dead.s3o]],
      reclaimable      = false,
      reclaimTime      = 0,
      world            = [[All Worlds]],
    },
	
	 HEAP  = {
      description      = [[Debris - pawn]],
      blocking         = false,
      category         = [[heaps]],
      damage           = 500,
      energy           = 0,
      featurereclamate = [[SMUDGE01]],
      footprintX       = 2,
      footprintZ       = 2,
      height           = [[4]],
      hitdensity       = [[100]],
      metal            = 0,
      object           = [[mech_heap.s3o]],
      reclaimable      = false,
      reclaimTime      = 0,
      seqnamereclamate = [[TREE1RECLAMATE]],
      world            = [[All Worlds]],
    },
  }
  unitDef.featureDefs = featureDefs

--------------------------------------------------------------------------------

return lowerkeys({ [unitName] = unitDef })

--------------------------------------------------------------------------------
